package com.ccl.iot.privates;

import com.ccl.iot.App;
import com.ccl.iot.R;
import com.ccl.iot.publics.Res;

import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FAILED;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_DEVICE_ALREADY_IN;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_DEVICE_EXIST;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_DEVICE_FORBIDDEN;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_DEVICE_INFO_INVALID;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_DEVICE_INVALID;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_OUT_OF_MEMORY;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_QUOTA_FULL;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_REGISTER_SPACE_TOO_BIG;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_SECURITY_CODE_WRONG;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_USER_ANSWER_WRONG;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_USER_EXIST;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_USER_FORBIDDEN;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_USER_INFO_INVALID;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_USER_INVALID;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_USER_NOLOGIN;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_USER_NOT_EXIST;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_USER_PASSWORD_WRONG;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_FATAL_USER_RELOGIN_LIMIT;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_GENERAL_AUTHORIZE_REJECT;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_GENERAL_AUTHORIZE_STATE_INVALID;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_GENERAL_BAD_STATUS;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_GENERAL_BATCH_EXIST;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_GENERAL_DEVICE_INFO_EXIST;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_GENERAL_NO_NOTIFY;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_GENERAL_PERMISSION_DENIED;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_GENERAL_UNSUPPORT;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_GENERAL_USER_INFO_EXIST;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_GENERAL_USER_OFFLINE;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_INVALID;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_NO_EFFECT;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_PARAMETER_INVALID;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_SERVER_BOOK_COMMSERVER_FAILED;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_SERVER_CONNECT_TO_DB_FAILED;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_SERVER_GEN_SID_FAILED;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_SERVER_GEN_UDID_FAILED;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_SERVER_GEN_USER_SID_FAILED;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_SERVER_UPDATE_TO_DB_FAILED;
import static com.ccl.iot.EIOT_RESULT.EIOT_RESULT_UNKNOWN;

public class APIConst {

    public static String getString(int result) {
        int ResId = -1;

        if (result == EIOT_RESULT_FATAL_USER_NOLOGIN) {
//            ResId = R.string.Fatal_UserNoLogin;
        } else if (result == EIOT_RESULT_FATAL_USER_INVALID) {
            ResId = R.string.Fatal_UserInvalid;
        } else if (result == EIOT_RESULT_FATAL_USER_EXIST) {
            ResId = R.string.Fatal_UserExist;
        } else if (result == EIOT_RESULT_FATAL_USER_NOT_EXIST) {
            ResId = R.string.Fatal_UserNotExist;
        } else if (result == EIOT_RESULT_FATAL_USER_PASSWORD_WRONG) {
            ResId = R.string.Fatal_UserPasswordWrong;
        } else if (result == EIOT_RESULT_FATAL_USER_RELOGIN_LIMIT) {
            ResId = R.string.Fatal_UserReLoginLimit;
        } else if (result == EIOT_RESULT_FATAL_USER_FORBIDDEN) {
            ResId = R.string.Fatal_UserForBidden;
        } else if (result == EIOT_RESULT_FATAL_USER_ANSWER_WRONG) {
            ResId = R.string.Fatal_UserAnswerWrong;
        } else if (result == EIOT_RESULT_UNKNOWN) {
            ResId = R.string.UnKnown_Error;
        } else if (result == EIOT_RESULT_FATAL_DEVICE_INVALID) {
            ResId = R.string.Fatal_DeviceInvalid;
        } else if (result == EIOT_RESULT_FATAL_DEVICE_EXIST) {
            ResId = R.string.Fatal_DeviceExist;
        } else if (result == EIOT_RESULT_FATAL_DEVICE_ALREADY_IN) {
            ResId = R.string.Fatal_DeviceAlreadyIn;
        } else if (result == EIOT_RESULT_FATAL_DEVICE_FORBIDDEN) {
            ResId = R.string.Fatal_DeviceForbidden;
        } else if (result == EIOT_RESULT_FATAL_QUOTA_FULL) {
            ResId = R.string.Fatal_QuotaFull;
        } else if (result == EIOT_RESULT_FATAL_DEVICE_INFO_INVALID) {
            ResId = R.string.Fatal_DeviceInfoInvalid;
        } else if (result == EIOT_RESULT_FATAL_REGISTER_SPACE_TOO_BIG) {
            ResId = R.string.Fatal_RegisterSpaceTooBig;
        } else if (result == EIOT_RESULT_FATAL_SECURITY_CODE_WRONG) {
            ResId = R.string.Fatal_SecurityCodeWrong;
        } else if (result == EIOT_RESULT_FATAL_USER_INFO_INVALID) {
            ResId = R.string.Fatal_UserInfoInvalid;
        } else if (result == EIOT_RESULT_FATAL_OUT_OF_MEMORY) {
            ResId = R.string.Fatal_OutOfMemory;
        } else if (result == EIOT_RESULT_SERVER_CONNECT_TO_DB_FAILED) {
            ResId = R.string.Server_ConnectToDbFailed;
        } else if (result == EIOT_RESULT_SERVER_UPDATE_TO_DB_FAILED) {
            ResId = R.string.Server_UpdeteToDbFailed;
        } else if (result == EIOT_RESULT_SERVER_GEN_UDID_FAILED) {
            ResId = R.string.Server_GenUdidFailed;
        } else if (result == EIOT_RESULT_SERVER_BOOK_COMMSERVER_FAILED) {
            ResId = R.string.Server_BookCommserverFailed;
        } else if (result == EIOT_RESULT_SERVER_GEN_USER_SID_FAILED) {
            ResId = R.string.Server_GenUserSidFailed;
        } else if (result == EIOT_RESULT_SERVER_GEN_SID_FAILED) {
            ResId = R.string.Server_GenSidFailed;
        } else if (result == EIOT_RESULT_GENERAL_BATCH_EXIST) {
            ResId = R.string.General_BatchExist;
        }/* else if (result == EIOT_RESULT_GENERAL_NO_BATCH) {
            ResId = R.string.General_NoBatch;
        } else if (result == EIOT_RESULT_GENERAL_BATCH_NO_ITEM) {
            ResId = R.string.General_BatchNoItem;
        } else if (result == EIOT_RESULT_GENERAL_WRITE_ACCEPTED) {
            ResId = R.string.General_WriteAccepted;
        } else if (result == EIOT_RESULT_GENERAL_WRITE_UNACCEPTE) {
            ResId = R.string.General_WriteUnAccepted;
        } else if (result == EIOT_RESULT_GENERAL_REGISTER_INVALID) {
            ResId = R.string.General_RegInvalid;
        } else if (result == EIOT_RESULT_GENERAL_REGISTER_NO_CHANGE) {
            ResId = R.string.General_RegNoChange;
        }*/ else if (result == EIOT_RESULT_GENERAL_USER_OFFLINE) {
            ResId = R.string.General_UserOffline;
        } else if (result == EIOT_RESULT_GENERAL_USER_INFO_EXIST) {
            ResId = R.string.General_UserInfoExist;
        }/* else if (result == EIOT_RESULT_GENERAL_NO_USER_INFO) {
            ResId = R.string.General_NoUserInfo;
        } else if (result == EIOT_RESULT_GENERAL_DEVICE_OFFLINE) {
            ResId = R.string.General_DeviceOffline;
        }*/ else if (result == EIOT_RESULT_GENERAL_DEVICE_INFO_EXIST) {
            ResId = R.string.General_DeviceInfoExist;
        }/* else if (result == EIOT_RESULT_GENERAL_NO_DEVICE_INFO) {
            ResId = R.string.General_NoDeviceInfo;
        } else if (result == EIOT_RESULT_GENERAL_NO_ONLINE_DEVICE) {
            ResId = R.string.General_NoOnlineDevice;
        } else if (result == EIOT_RESULT_GENERAL_NO_UPGRADE_DEVICE) {
            ResId = R.string.General_NoUpGradeDevice;
        } else if (result == EIOT_RESULT_GENERAL_DEVICE_NORESPONSE) {
            ResId = R.string.General_DeviceNoResponse;
        } else if (result == EIOT_RESULT_GENERAL_PATCH_UNSUPPORT) {
            ResId = R.string.General_PatchUnsupport;
        } else if (result == EIOT_RESULT_GENERAL_PATCH_NEWEST) {
            ResId = R.string.General_PatchNewest;
        } else if (result == EIOT_RESULT_GENERAL_PATCH_SIZE_LIMIT) {
            ResId = R.string.General_PatchSizeLimit;
        }*/ else if (result == EIOT_RESULT_GENERAL_AUTHORIZE_REJECT) {
            ResId = R.string.General_AuthReject;
        } else if (result == EIOT_RESULT_GENERAL_AUTHORIZE_STATE_INVALID) {
            ResId = R.string.General_AuthStateInvalid;
        } /*else if (result == EIOT_RESULT_GENERAL_NO_AUTHORIZE_DEVICE) {
            ResId = R.string.General_NoAuthDevice;
        } else if (result == EIOT_RESULT_GENERAL_NO_AUTHORIZE_USER) {
            ResId = R.string.General_NoAuthUser;
        } else if (result == EIOT_RESULT_GENERAL_PERMISSION_WAITTING) {
            ResId = R.string.General_PermissionWaitting;
        } else if (result == EIOT_RESULT_GENERAL_PERMISSION_READ_ONLY) {
            ResId = R.string.General_PermissionReadOnly;
        } else if (result == EIOT_RESULT_GENERAL_PERMISSION_WRITE_ONLY) {
            ResId = R.string.General_PermissionWriteOnly;
        }*/ else if (result == EIOT_RESULT_GENERAL_PERMISSION_DENIED) {
            ResId = R.string.General_PermissionDenied;
        }/* else if (result == EIOT_RESULT_TIMEOUT) {
            ResId = R.string.Result_Timeout;
        }*/ else if (result == EIOT_RESULT_FAILED) {
            ResId = R.string.Result_Failed;
        } else if (result == EIOT_RESULT_INVALID) {
            ResId = R.string.Result_Invalid;
        } else if (result == EIOT_RESULT_PARAMETER_INVALID) {
            ResId = R.string.Result_Parameter_Invalid;
        } else if (result == EIOT_RESULT_NO_EFFECT) {
            ResId = R.string.Result_NoDffect;
        } else if (result == EIOT_RESULT_GENERAL_UNSUPPORT) {
            ResId = R.string.General_Unsupport;
        } else if (result == EIOT_RESULT_GENERAL_BAD_STATUS) {
            ResId = R.string.General_BadStatus;
        } else if (result == EIOT_RESULT_GENERAL_NO_NOTIFY) {
            ResId = R.string.General_NoNotify;
        }
        if (ResId != -1) {
            return Res.GetString(App.getContext(), ResId);
        }

        return null;
    }

}
